var removeNthFromEnd = function(head, n) {
    const dummyHead = new ListNode(0);
    dummyHead.next = head
    let right = dummyHead
    let left = dummyHead
    while(n--){
        right = right.next
    }
    while(right.next!==null){
        left = left.next
        right = right.next
    }
    left.next = left.next.next
    return dummyHead.next

};